package com.view;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.controller.LocationManager;

@SuppressWarnings("serial")
public class DeleteLocationServlet extends HttpServlet{
	private LocationManager locationManager = new LocationManager();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		if(req.getSession().getAttribute("LoggedIn") == null){
			resp.sendRedirect("/index.jsp");
		}
		String appUsername = (String)req.getSession().getAttribute("UserName");
		String locationName = req.getParameter("locationName");
		locationManager.deleteLocation(appUsername,locationName);
		resp.sendRedirect("/register_location.jsp");
	}

}
